<template>
  <div class="about">
    <h1>This is an about page</h1>
    <button @click="getUserInfo">获取用户信息</button>
    <div v-if="userinfo">
      <p>用户名: {{ userinfo.name }}</p>  
      <p>年龄: {{ userinfo.age }}</p>      

    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  data() {
    return {
      userinfo: {}
    };
  },
  name: "AboutView",
  components: {},
  methods: {
    getUserInfo() {
       axios.get('/api/userinfo').then(res => {
      // console.log(res)
      this.userinfo = res.data.data
    })
    },
  },
};
</script>

<style scoped>
.about {
  padding: 20px;
}

</style>
